package com.todo.strategy.offline.infrastructure.convert;


import com.todo.strategy.offline.infrastructure.entity.domain.PlatformStrategyDO;
import com.todo.strategy.offline.infrastructure.entity.po.PlatformStrategyDetailPO;
import com.todo.strategy.offline.infrastructure.entity.po.PlatformStrategyPO;

/**
 * @author zhangwenxiang
 * @date 2024/3/29 23:39
 * @description
 */
public class StrategyConvert {

    public static PlatformStrategyDO convertToPlatformStrategyDO(PlatformStrategyPO platformStrategyPO, PlatformStrategyDetailPO platformStrategyDetailPO) {
        if (platformStrategyPO == null || platformStrategyDetailPO == null) {
            return null;
        }
        PlatformStrategyDO platformStrategyDO = new PlatformStrategyDO();
        platformStrategyDO.setId(platformStrategyPO.getId());
        platformStrategyDO.setIsDelete(platformStrategyPO.getIsDelete());
        platformStrategyDO.setCreateUser(platformStrategyPO.getCreateUser());
        platformStrategyDO.setLastUpdateUser(platformStrategyPO.getLastUpdateUser());
        platformStrategyDO.setCreateTime(platformStrategyPO.getCreateTime());
        platformStrategyDO.setUpdateTime(platformStrategyPO.getUpdateTime());

        PlatformStrategyDO.StrategyDetail strategyDetail = new PlatformStrategyDO.StrategyDetail();
        strategyDetail.setAgeSuggest(platformStrategyDetailPO.getAgeSuggest());
        strategyDetail.setTravelSuggest(platformStrategyDetailPO.getTravelSuggest());
        strategyDetail.setInstructions(platformStrategyDetailPO.getInstructions());
        strategyDetail.setSecuritySuggest(platformStrategyDetailPO.getSecuritySuggest());
        strategyDetail.setRemark(platformStrategyDetailPO.getRemark());
        strategyDetail.setExtra(platformStrategyDetailPO.getExtra());
        platformStrategyDO.setStrategyDetail(strategyDetail);

        PlatformStrategyDO.BaseStrategyInfo baseStrategyInfo = new PlatformStrategyDO.BaseStrategyInfo();
        baseStrategyInfo.setCity(platformStrategyPO.getCity());
        baseStrategyInfo.setTimeCost(platformStrategyPO.getTimeCost());
        baseStrategyInfo.setTravelTimeType(platformStrategyPO.getTravelTimeType());
        baseStrategyInfo.setIsFree(platformStrategyPO.getIsFree());
        baseStrategyInfo.setMoneyCost(platformStrategyPO.getMoneyCost());
        baseStrategyInfo.setScore(platformStrategyPO.getScore());
        baseStrategyInfo.setStatus(platformStrategyPO.getStatus());
        baseStrategyInfo.setAllowComment(platformStrategyPO.getAllowComment());
        baseStrategyInfo.setReferenceCount(platformStrategyPO.getReferenceCount());
        baseStrategyInfo.setTitle(platformStrategyPO.getTitle());
        baseStrategyInfo.setProvince(platformStrategyPO.getProvince());
        baseStrategyInfo.setRecommendMonth(platformStrategyPO.getRecommendMonth());
        baseStrategyInfo.setMainImg(platformStrategyPO.getMainImg());
        baseStrategyInfo.setRecommendDesc(platformStrategyPO.getRecommendDesc());
        baseStrategyInfo.setStrategyType(platformStrategyPO.getStrategyType());
        platformStrategyDO.setBaseStrategyInfo(baseStrategyInfo);
        return platformStrategyDO;
    }

    public static PlatformStrategyPO buildPlatformStrategyPO(PlatformStrategyDO platformStrategyDO) {
        if (platformStrategyDO == null || platformStrategyDO.getBaseStrategyInfo() == null) {
            return null;
        }
        PlatformStrategyPO platformStrategyPO = new PlatformStrategyPO();
        PlatformStrategyDO.BaseStrategyInfo baseStrategyInfo = platformStrategyDO.getBaseStrategyInfo();
        platformStrategyPO.setCity(baseStrategyInfo.getCity());
        platformStrategyPO.setTimeCost(baseStrategyInfo.getTimeCost());
        platformStrategyPO.setTravelTimeType(baseStrategyInfo.getTravelTimeType());
        platformStrategyPO.setIsFree(baseStrategyInfo.getIsFree());
        platformStrategyPO.setMoneyCost(baseStrategyInfo.getMoneyCost());
        platformStrategyPO.setScore(baseStrategyInfo.getScore());
        platformStrategyPO.setStatus(baseStrategyInfo.getStatus());
        platformStrategyPO.setAllowComment(baseStrategyInfo.getAllowComment());
        platformStrategyPO.setReferenceCount(baseStrategyInfo.getReferenceCount());
        platformStrategyPO.setTitle(baseStrategyInfo.getTitle());
        platformStrategyPO.setProvince(baseStrategyInfo.getProvince());
        platformStrategyPO.setRecommendMonth(baseStrategyInfo.getRecommendMonth());
        platformStrategyPO.setMainImg(baseStrategyInfo.getMainImg());
        platformStrategyPO.setRecommendDesc(baseStrategyInfo.getRecommendDesc());
        platformStrategyPO.setStrategyType(baseStrategyInfo.getStrategyType());
        platformStrategyPO.setId(platformStrategyDO.getId());
        return platformStrategyPO;
    }

    public static PlatformStrategyDetailPO buildPlatformStrategyDetailPO(PlatformStrategyDO platformStrategyDO) {
        if (platformStrategyDO == null || platformStrategyDO.getStrategyDetail() == null) {
            return null;
        }
        PlatformStrategyDetailPO platformStrategyDetailPO = new PlatformStrategyDetailPO();
        PlatformStrategyDO.StrategyDetail strategyDetail = platformStrategyDO.getStrategyDetail();
        platformStrategyDetailPO.setAgeSuggest(strategyDetail.getAgeSuggest());
        platformStrategyDetailPO.setTravelSuggest(strategyDetail.getTravelSuggest());
        platformStrategyDetailPO.setInstructions(strategyDetail.getInstructions());
        platformStrategyDetailPO.setSecuritySuggest(strategyDetail.getSecuritySuggest());
        platformStrategyDetailPO.setRemark(strategyDetail.getRemark());
        platformStrategyDetailPO.setExtra(strategyDetail.getExtra());
        return platformStrategyDetailPO;
    }
}
